package tinking.java.operator;

class Letter {
    char c;
}

public class PassObject {
    static void f(Letter y) {
        y.c = 'z';
    }

    public static void main(String[] args) {
        Letter x = new Letter();
        // 改变对象x的属性c的值
        x.c = 'a';
        System.out.println("1: x.c: " + x.c);

        // 将x作为参数传递给方法f，此处对戏那个被别名，y持有对象x的引用,y改变属性c的值，其实就是改变x的属性c的值
        f(x);
        System.out.println("2: x.c: " + x.c);
    }
}